package com.yuneec.rcdronesercive;

import com.yuneec.droneservice.command.BaseCommand;
import com.yuneec.droneservice.request.CommonResponseHandler;
import com.yuneec.droneservice.utils.ByteUtils;

/**
 * Created by zd.zhang on 2017/10/31.
 */

public class RCIRH extends CommonResponseHandler {
    public int commandId;
    public byte[] data;
    public int offset;
    public int length;

    public RCIRH(int commandId, byte[] data, int offset, int length) {
        this.commandId = commandId;
        this.data = data;
        this.offset = offset;
        this.length = length;
    }

    @Override
    public int ids() {
        return commandId;
    }

    public void handle() {
        length = ByteUtils.byteArrayToShort(data, offset + 2, BaseCommand.IS_BIGENDIAN);
        offset = offset + 4;
    }
}
